package com.lecture.java8.geekbang.demo06;

public class Application {

    public static final String configSource = "模拟注册中心";
    public static final RedisConfig redisConfig = new RedisConfig(configSource);
    public static final MysqlConfig mysqlConfig = new MysqlConfig(configSource);
    public static final KafkaConfig kafkaConfig = new KafkaConfig(configSource);


    public static void main(String[] args) {
        ScheduledUpdater redisConfigUpdate  = new ScheduledUpdater(redisConfig,300,300);
        redisConfigUpdate.run();
        ScheduledUpdater kafkaConfigUpdate  = new ScheduledUpdater(kafkaConfig,300,300);
        redisConfigUpdate.run();

        SimpleHttpServer simpleHttpServer = new SimpleHttpServer("127.0.0.1:",23801);
        simpleHttpServer.addViewer("/config",redisConfig);
        simpleHttpServer.addViewer("/config",mysqlConfig);
        simpleHttpServer.run();
    }
}
